<?php
	error_reporting(E_ALL^E_NOTICE);
    require_once ('../config/config.php'); 
	session_start();
	if($_GET['ops']=="logout"){
	    //session_destroy();
	    unset($_SESSION['member']);
	    echo "<script>alert('成功退出！');location='./index.php';</script>";
	}
	if(empty($_SESSION['member'])){
		echo "<script>location='./index.php';</script>";
	}else{
		$userRs=mysqli_fetch_array(mysqli_query($con,"select * from member where user='".$_SESSION['member']."'"));
	}
	$linkRs=mysqli_fetch_array(mysqli_query($con,"select * from link where user='".$_SESSION['member']."'"));
	if($_GET['ops']=="link"){
	    require_once './api/config/config.php';
    	if (empty($AppId) or empty($AuthAPI) or empty($API)) {
            exit("请配置华宇通行证config.php文件！");
        }else{
            echo "<script>location='".$AuthAPI."?Id=".$AppId."';</script>";
        }
	}
	if($_GET['ops']=="nolink"){
	    mysqli_query($con,"DELETE FROM `link` WHERE `user`='".$_SESSION['member']."'");
	    echo "<script>location='./company.php';</script>";
	}
	if($_POST['submit']){
		$oldpass=md5($_POST['oldpass']);
		$newpass=md5($_POST['newpass']);
		$confirmpass=md5($_POST['confirmpass']);
		if(empty($oldpass) or empty($newpass) or empty($confirmpass) or $newpass!=$confirmpass or $oldpass!=$userRs['password']){
			echo "<script>alert('请检查后重试！');history.back();</script>";
		}else{
			mysqli_query($con,"update member set password='".$newpass."' where user='".$_SESSION['member']."'");
			unset($_SESSION['member']);
	    	echo "<script>alert('密码修改成功，请重新登陆！');location='./index.php';</script>";
		}
	}
?>
<html lang="zh-CN" class="translated-ltr"><head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

	<!-- CSS -->
	<link rel="stylesheet" href="css/bootstrap-reboot.min.css">
	<link rel="stylesheet" href="css/bootstrap-grid.min.css">
	<link rel="stylesheet" href="css/owl.carousel.min.css">
	<link rel="stylesheet" href="css/nouislider.min.css">
	<link rel="stylesheet" href="css/select2.min.css">
	<link rel="stylesheet" href="css/jquery.mCustomScrollbar.min.css">
	<link rel="stylesheet" href="css/ionicons.min.css">
	<link rel="stylesheet" href="css/main.css">

	<!-- Favicons -->
	<link rel="icon" type="image/png" href="icon/favicon-32x32.png" sizes="32x32">
	<link rel="apple-touch-icon" href="icon/favicon-32x32.png">
	<link rel="apple-touch-icon" sizes="72x72" href="icon/apple-touch-icon-72x72.png">
	<link rel="apple-touch-icon" sizes="114x114" href="icon/apple-touch-icon-114x114.png">
	<link rel="apple-touch-icon" sizes="144x144" href="icon/apple-touch-icon-144x144.png">

	<meta name="description" content="">
	<meta name="keywords" content="">
	<meta name="author" content="Dmitry Volkov">
	<title>校园简直网站 - 个人信息</title>
<link type="text/css" rel="stylesheet" charset="UTF-8" href="https://translate.googleapis.com/translate_static/css/translateelement.css"></head>

<body>
	<!-- header -->
	<header class="header">
		<div class="container">
			<div class="row">
				<div class="col-7 col-md-9 col-lg-8 col-xl-9">
					<div class="header__content">
						<!-- header menu btn -->
						<button class="header__btn" type="button">
							<span></span>
							<span></span>
							<span></span>
						</button>
						<!-- end header menu btn -->

						<!-- header logo -->
						<a href="index.php" class="header__logo">
							<b>校园兼职网站</b>
						</a>
						<!-- end header logo -->

						<!-- header nav -->
						<ul class="header__nav">
							<!-- dropdown -->
							<li class="header__nav-item">
								<a href="index.php" class="header__nav-link"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">首页</font></font></a>
							</li>
							<li class="header__nav-item">
								<a href="news.php" class="header__nav-link"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">新闻</font></font></a>
							</li>
							<!-- end dropdown -->

							<!-- dropdown -->
							<li class="header__nav-item">
								<a class="dropdown-toggle header__nav-link" href="#" role="button" id="dropdownMenuProjects" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">分类</font></font></a>

								<ul class="dropdown-menu header__dropdown-menu" aria-labelledby="dropdownMenuProjects">
									<?php
										$result=mysqli_query($con,"select * from class order by id asc");
										while($rs=mysqli_fetch_array($result)){
									?>
											<li><a href="index.php?classId=<?php echo $rs['id'];?>"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><?php echo $rs['className'];?></font></font></a></li>
									<?php }?>
								</ul>
							</li>
							<!-- end dropdown -->

							<!-- dropdown -->
							<li class="header__nav-item">
								<a class="dropdown-toggle header__nav-link" href="#" role="button" id="dropdownMenuJobs" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">商家服务</font></font></a>

								<ul class="dropdown-menu header__dropdown-menu" aria-labelledby="dropdownMenuJobs">
									<li><a href="add-job.php"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">发布工作</font></font></a></li>
								</ul>
							</li>
							<!-- end dropdown -->
						</ul>
						<!-- end header nav -->

					</div>
				</div>

				<div class="col-5 col-md-3 col-lg-4 col-xl-3">
					<div class="header__content header__content--end">
						<div class="header__profile">
							<?php
								if(empty($_SESSION['member'])){?>
									<a href="./signin.php"  role="button" id="dropdownMenuProfile">
										<span>
											<font style="vertical-align: inherit;">
												<font style="vertical-align: inherit;">登录</font>
											</font>
										</span>
									</a>
							<?php
								}else{?>
									<a class="dropdown-toggle header__profile-btn" href="#"  role="button" id="dropdownMenuProfile" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
										<span>
											<font style="vertical-align: inherit;">
												<font style="vertical-align: inherit;">欢迎您，<?php echo $_SESSION['member'];?></font>
											</font>
										</span>
									</a>
									<ul class="dropdown-menu dropdown-menu-right header__dropdown-menu header__dropdown-menu--right" aria-labelledby="dropdownMenuProfile">
										<li><a href="./company.php"><i class="icon ion-ios-exit"></i><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">个人信息</font></font></a></li>
										<li><a href="./complaints-list.php"><i class="icon ion-ios-exit"></i><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">投诉记录</font></font></a></li>
										<li><a href="../master/login.php"><i class="icon ion-ios-exit"></i><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">后台管理</font></font></a></li>
										<li><a href="./resume.php"><i class="icon ion-ios-exit"></i><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">我的简历</font></font></a></li>
										<li><a href="?ops=logout"><i class="icon ion-ios-exit"></i><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">登出</font></font></a></li>
									</ul>
							<?php
								}
							?>
						</div>
					</div>
				</div>
			</div>
		</div>
	</header>
	<!-- end header -->

	<!-- main content -->
	<main class="main main--breadcrumb">
		<!-- breadcrumb -->
		<div class="breadcrumb">
			<div class="container">
				<div class="row">
					<div class="col-12">
						<ul class="breadcrumb__wrap">
							<li class="breadcrumb__item"><a href="./index.php"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">首页</font></font></a></li>
							<li class="breadcrumb__item breadcrumb__item--active"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">个人中心</font></font></li>
						</ul>
					</div>
				</div>
			</div>
		</div>
		<!-- end breadcrumb -->

		<div class="container">
			<div class="row">
				<div class="col-12 col-md-5 col-lg-4 col-xl-3">
					<!-- user -->
					<div class="user">
						<div class="user__head">
							<div class="user__img">
								<img src="img/company.svg" alt="">
							</div>
						</div>
						<div class="user__title">
							<h2><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><br />欢迎您，<?php echo $_SESSION['member'];?> !</font></font></h2>
						</div>
					</div>
					<!-- end user -->

				</div>

				<div class="col-12 col-md-7 col-lg-8 col-xl-6">
					<div class="tab-content">
						<div class="tab-pane fade active show" id="tab-3" role="tabpanel" aria-labelledby="tab-3">
							<!-- form -->
							<form action="#" class="form">
								<div class="row">
									<div class="col-12">
										<h2 class="form__title"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">个人资料详细信息</font></font></h2>
									</div>

									<div class="col-12 col-lg-6">
										<div class="form__group">
											<label for="login" class="form__label"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">用户名：</font></font></label>
											<input name="login" id="login" type="text" class="form__input" placeholder="<?php echo $userRs['user'];?>" value="<?php echo $userRs['user'];?>" readonly="readonly">
										</div>
									</div>
									
									<div class="col-12 col-lg-6">
										<div class="form__group">
											<label for="login" class="form__label"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">华宇通行证：</font></font></label>
											<?php
											    if($linkRs['hy']==""){
											        echo "<a href='?ops=link'><input id='login' type='text' class='form__input' placeholder='立即绑定' value='立即绑定' readonly='readonly'></a>";
											    }else{
											        echo "<a href='?ops=nolink'><input id='login' type='text' class='form__input' placeholder='立即解除绑定' value='立即解除绑定' readonly='readonly'></a>";
											    }
											?>
										</div>
									</div>

									<div class="col-12 col-lg-6">
										<div class="form__group">
											<label for="email" class="form__label"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">电子邮件：</font></font></label>
											<input name="email" id="email" type="text" class="form__input" placeholder="<?php echo $userRs['email'];?>" value="<?php echo $userRs['email'];?>" readonly="readonly">
										</div>
									</div>

									<div class="col-12 col-lg-6">
										<div class="form__group">
											<label for="firstname" class="form__label"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">姓名：</font></font></label>
											<input name="firstname" id="firstname" type="text" class="form__input" placeholder="<?php echo $userRs['name'];?>" value="<?php echo $userRs['name'];?>" readonly="readonly">
										</div>
									</div>
								</div>
							</form>
							<!-- end form -->

							<!-- form -->
							<form action="" method="post" class="form">
								<div class="row">
									<div class="col-12">
										<h2 class="form__title"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">更改密码</font></font></h2>
									</div>

									<div class="col-12 col-lg-6">
										<div class="form__group">
											<label for="oldpass" class="form__label"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">旧密码：</font></font></label>
											<input name="oldpass" id="oldpass" type="password" class="form__input">
										</div>
									</div>

									<div class="col-12 col-lg-6">
										<div class="form__group">
											<label for="newpass" class="form__label"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">新密码：</font></font></label>
											<input name="newpass" id="newpass" type="password" class="form__input">
										</div>
									</div>

									<div class="col-12 col-lg-6">
										<div class="form__group">
											<label for="confirmpass" class="form__label"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">确认新密码：</font></font></label>
											<input name="confirmpass" id="confirmpass" type="password" class="form__input">
										</div>
									</div>

									<div class="col-12">
										<input class="form__btn" type="submit" name="submit" value="更改密码">
									</div>
								</div>
							</form>
							<!-- end form -->
						</div>
					</div>
				</div>

				<div class="col-12 col-md-5 col-lg-4 col-xl-3">
					<!-- sidebox -->
					<div class="sidebox sidebox--desk">
						<h4 class="sidebox__title"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">最新十条兼职信息</font></font></h4>
						<div class="sidebox__content">
							<div class="sidebox__job">
								<?php
									$newResult=mysqli_query($con,"select * from content order by id desc");
									$count=1;
									while($newRs=mysqli_fetch_array($newResult)){
										if($newRs['state']=="1"){
											if($count<=10){
												$count=$count+1;
												echo "<div class='sidebox__job-title'>
												<a href='./job.php?id=".$newRs['id']."'><font style='vertical-align: inherit;'><font style='vertical-align: inherit;'>".$newRs['title']."</font></font></a>
												<span><font style='vertical-align: inherit;'><font style='vertical-align: inherit;'>￥ ".$newRs['salary']." /小时</font></font></span>
											</div>";
											}else{
												return;
											}
										}
									}
								?>
							</div>
						</div>
					</div>
					<!-- end sidebox -->
				</div>
			</div>
		</div>
	</main>
	<!-- end main content -->

	<!-- footer -->
	<footer class="footer">
		<div class="container">
			<div class="row">
				<div class="col-12">
					<div class="footer__content">
						<a href="index.php" class="footer__logo">
							校园兼职网站
						</a>

						<span class="footer__copyright"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">&copy;2022 <a href="http://www.huayu.edu.cn" target="_black">山东华宇工学院</a> SomeRights</font></font></span>


						<button class="footer__back" type="button">
							<i class="icon ion-ios-arrow-round-up"></i>
						</button>
					</div>
				</div>
			</div>
		</div>
	</footer>
	<!-- end footer -->

	<!-- JS -->
	<script src="js/jquery-3.4.1.min.js"></script>
	<script src="js/bootstrap.bundle.min.js"></script>
	<script src="js/owl.carousel.min.js"></script>
	<script src="js/wNumb.js"></script>
	<script src="js/nouislider.min.js"></script>
	<script src="js/select2.min.js"></script>
	<script src="js/jquery.mousewheel.min.js"></script>
	<script src="js/jquery.mCustomScrollbar.min.js"></script>
	<script src="js/main.js"></script><div id="goog-gt-tt" class="skiptranslate" dir="ltr"><div style="padding: 8px;"><div><div class="logo"><img src="https://www.gstatic.com/images/branding/product/1x/translate_24dp.png" width="20" height="20" alt="Google 翻译"></div></div></div><div class="top" style="padding: 8px; float: left; width: 100%;"><h1 class="title gray">原文</h1></div><div class="middle" style="padding: 8px;"><div class="original-text"></div></div><div class="bottom" style="padding: 8px;"><div class="activity-links"><span class="activity-link">提供更好的翻译建议</span><span class="activity-link"></span></div><div class="started-activity-container"><hr style="color: #CCC; background-color: #CCC; height: 1px; border: none;"><div class="activity-root"></div></div></div><div class="status-message" style="display: none;"></div></div>

<div class="goog-te-spinner-pos"><div class="goog-te-spinner-animation"><svg xmlns="http://www.w3.org/2000/svg" class="goog-te-spinner" width="96px" height="96px" viewBox="0 0 66 66"><circle class="goog-te-spinner-path" fill="none" stroke-width="6" stroke-linecap="round" cx="33" cy="33" r="30"></circle></svg></div></div></body></html>